package com.miz.bincalc;

import android.os.Bundle;
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TabHost;

public class SBC extends TabActivity{
	private TabHost tabHost;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sbc);
        
        Resources res = getResources();
        tabHost = getTabHost();
        TabHost.TabSpec spec;
        Intent intent;
        
        //Calc tab
        intent = new Intent(this, CalcActivity.class);
        spec = tabHost.newTabSpec("calc")
        		.setIndicator("Calculator", res.getDrawable(R.drawable.binico))
        		.setContent(intent);
        tabHost.addTab(spec);
        
        //Result tab
        intent = new Intent(this, ResultActivity.class);
        spec = tabHost.newTabSpec("result")
        		.setIndicator("Result")
        		.setContent(intent);
        tabHost.addTab(spec);
        getLocalActivityManager().startActivity("result", intent);
        
        //Info tab
        intent = new Intent(this, InfoActivity.class);
        spec = tabHost.newTabSpec("info")
        		.setIndicator("Info")
        		.setContent(intent);
        tabHost.addTab(spec);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_sbc, menu);
        return true;
    }
    
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
    	ResultActivity.setText("");
        return true;
    }
}
